<template>
  <div>
    <Table :columns="titleName" :data="data" stripe />
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      titleName: [
        {
          title: "序号",
          render: (h, { row }) => {
            const index = <div>{row._index + 1}</div>;
            return index;
          }
        },
        {
          title: "变更前",
          key: "change_before"
        },
        {
          title: "变更后",
          key: "change_after"
        },
        {
          title: "变更类型",
          // key: 'change_type',
          render: (h, { row }) => <div>{row.change_type || "-"}</div>
        },
        {
          title: "关联数据",
          // key: 'change_params',
          width: "180px",
          render: (h, { row }) => <div>{row.change_params || "-"}</div>
        },
        {
          title: "备注",
          key: "remark"
        },
        {
          title: "变更时间",
          render: (h, { row }) => {
            this.$moment.locale(navigator.language);
            let real_startTime = this.$moment
              .utc(`${row.created_at}`)
              .local()
              .format("lll");
            return <div>{real_startTime}</div>;
          }
        }
      ]
    };
  }
};
</script>
